package cn.admin.remoting;


import java.util.concurrent.Executor;

public interface RequestProcessor<T> {

    Class<T> interest();

    void handleRequest(T request, AppResponseOutput output);

    Executor getExecutor();

    void onRejectedExecutionException(T appRequest, AppResponseOutput respOut);

    interface MultiExecutorRequestProcessor<T> extends RequestProcessor<T> {

        Executor getExecutor(T request);
    }

    interface AppResponseOutput {

        long requestId();

        void write(Object appResp);

        String remoteHost();

        Connection getConnection();

    }

    interface RequestPreProcessor {

        void beforeHandleRequest(long requestId, byte serializeProtocol, byte direction);

    }

}
